<!doctype html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../assert_selection.js"></script>
<script>

selection_test(
  '<div contenteditable dir="rtl" style="white-space: pre;">|abc<!-- -->\n<!-- -->def</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl" style="white-space: pre;">a|bc \n def</div>',
  '41-0 rtl left character');

selection_test(
  '<div contenteditable dir="rtl" style="white-space: pre;">a|bc<!-- -->\n<!-- -->def</div>',
  selection => selection.modify('move', 'left', 'character'),
   '<div contenteditable dir="rtl" style="white-space: pre;">ab|c \n def</div>',
  '41-1 rtl left character');

selection_test(
  '<div contenteditable dir="rtl" style="white-space: pre;">ab|c<!-- -->\n<!-- -->def</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl" style="white-space: pre;">abc| \n def</div>',
  '41-2 rtl left character');

selection_test(
  '<div contenteditable dir="rtl" style="white-space: pre;">abc|<!-- -->\n<!-- -->def</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl" style="white-space: pre;">abc \n |def</div>',
  '41-3 rtl left character');

selection_test(
  '<div contenteditable dir="rtl" style="white-space: pre;">abc<!-- -->|\n<!-- -->def</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl" style="white-space: pre;">abc \n |def</div>',
  '41-4 rtl left character');

selection_test(
  '<div contenteditable dir="rtl" style="white-space: pre;">abc<!-- -->\n|<!-- -->def</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl" style="white-space: pre;">abc \n d|ef</div>',
  '41-5 rtl left character');

selection_test(
  '<div contenteditable dir="rtl" style="white-space: pre;">abc<!-- -->\n<!-- -->|def</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl" style="white-space: pre;">abc \n d|ef</div>',
  '41-6 rtl left character');

selection_test(
  '<div contenteditable dir="rtl" style="white-space: pre;">abc<!-- -->\n<!-- -->d|ef</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl" style="white-space: pre;">abc \n de|f</div>',
  '41-7 rtl left character');

selection_test(
  '<div contenteditable dir="rtl" style="white-space: pre;">abc<!-- -->\n<!-- -->de|f</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl" style="white-space: pre;">abc \n def|</div>',
  '41-8 rtl left character');

selection_test(
  '<div contenteditable dir="rtl" style="white-space: pre;">abc<!-- -->\n<!-- -->def|</div>',
  selection => selection.modify('move', 'left', 'character'),
  '<div contenteditable dir="rtl" style="white-space: pre;">abc \n def|</div>',
  '41-9 rtl left character');
</script>
